# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2023年02月23日
"""

import docx
# from docx.enum.text import WD_ALIGN_PARAGRAPH

myDocument = docx.Document()
myDocument.add_paragraph('打折商品推荐书')
# 新建第1节
mySection1=myDocument.add_section()
myParagraph1 = myDocument.add_paragraph('第1节 进口水果')
myDocument.add_picture('image11.jpg')
myDocument.add_picture('image12.jpg')
# 新建第2节
mySection1=myDocument.add_section()
myParagraph1 = myDocument.add_paragraph('第2节 当季蔬菜')
myDocument.add_picture('image21.jpg')
myDocument.add_picture('image22.jpg')

# 新建第3节
mySection1=myDocument.add_section()
myParagraph1 = myDocument.add_paragraph('第2节 川渝火锅')
myDocument.add_picture('image31.jpg')
myDocument.add_picture('image32.jpg')

for myParagraph in myDocument.paragraphs:
	myParagraph.paragraph_format.alignment=docx.enum.text.WD_ALIGN_PARAGRAPH.CENTER
	for myRun in myParagraph.runs:
		myRun.font.name='Times New Roman'
		myRun.font.element.rPr.rFonts.set(docx.oxml.ns.qn('w:eastAsia'),'楷体')
		myRun.font.size=docx.shared.Pt(36)

myDocument.save("02散文名篇.docx")

